//
//  FindNewsCollectionViewModel.m
//  MoXiProject
//
//  Created by 沈晨宇 on 2017/7/20.
//  Copyright © 2017年 周筱雯. All rights reserved.
//

#import "FindNewsCollectionViewModel.h"
//#import "FindNewsCollectionModel.h"
@implementation FindNewsCollectionViewModel

- (instancetype)init
{
    self = [super init];
    if (self) {
        
        self.newsList = [[NSMutableArray alloc] initWithCapacity:0];

    }
    return self;
}
//收藏列表
- (RACSignal *)FindNewsCollectionParameter:(NSString *)userId{

    return [RACSignal createSignal:^RACDisposable *(id<RACSubscriber> subscriber) {
        
        NSDictionary *param = @{@"userId"  :userId
                                };
        
        [ScyRequestOperationManager FindNewsCollectionParametersDic:param success:^(NSDictionary *result) {
            
            
            if (result) {
                
                self.newsList =(NSMutableArray *)[MTLJSONAdapter modelsOfClass:[FindNewsCollectionModel class] fromJSONArray:result[@"result"] error:nil];
                
            }

            [subscriber sendNext:result];
            [subscriber sendCompleted];
            
        } failture:^(id result) {
            
            [subscriber sendError:result];
            
        }];
        return nil;
    }];

}
@end
